import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '姓名',
    align:"center",
    dataIndex: 'realname'
   },
   {
    title: '联系电话',
    align:"center",
    dataIndex: 'phone'
   },
   {
    title: '角色名称',
    align:"center",
    dataIndex: 'roleName'
   },
   {
    title: '打卡时间',
    align:"center",
    dataIndex: 'checkInTime'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: '姓名',
    field: 'realname',
    component: 'JInput',
  },
  {
    label: '联系电话',
    field: 'phone',
    component: 'JInput',
  },
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '租户号',
    field: 'tenantId',
    component: 'Input',
  },
  {
    label: '部门编码',
    field: 'orgCode',
    component: 'Input',
  },
  {
    label: '用户id',
    field: 'userId',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入用户id!'},
          ];
     },
  },
  {
    label: '用户名',
    field: 'username',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入用户名!'},
          ];
     },
  },
  {
    label: '真实姓名',
    field: 'realname',
    component: 'Input',
  },
  {
    label: '电话',
    field: 'phone',
    component: 'Input',
  },
  {
    label: '用户类型;用户类型：teacher/教员；student/学员；user/普通用户；',
    field: 'userType',
    component: 'Input',
  },
  {
    label: '角色编码',
    field: 'roleCode',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入角色编码!'},
          ];
     },
  },
  {
    label: '角色名称',
    field: 'roleName',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入角色名称!'},
          ];
     },
  },
  {
    label: '打卡时间',
    field: 'checkInTime',
    component: 'DatePicker',
    componentProps: {
       showTime: true,
       valueFormat: 'YYYY-MM-DD HH:mm:ss'
     },
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入打卡时间!'},
          ];
     },
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];

// 高级查询数据
export const superQuerySchema = {
  tenantId: {title: '租户号',order: 0,view: 'text', type: 'string',},
  orgCode: {title: '部门编码',order: 2,view: 'text', type: 'string',},
  userId: {title: '用户id',order: 3,view: 'text', type: 'string',},
  username: {title: '用户名',order: 4,view: 'text', type: 'string',},
  realname: {title: '真实姓名',order: 5,view: 'text', type: 'string',},
  phone: {title: '电话',order: 6,view: 'text', type: 'string',},
  userType: {title: '用户类型;用户类型：teacher/教员；student/学员；user/普通用户；',order: 7,view: 'text', type: 'string',},
  roleCode: {title: '角色编码',order: 8,view: 'text', type: 'string',},
  roleName: {title: '角色名称',order: 9,view: 'text', type: 'string',},
  checkInTime: {title: '打卡时间',order: 10,view: 'datetime', type: 'string',},
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
